<?php
require_once(dirname(__FILE__) . '/../mapper/mmw_mapper_BookmarkMapper.php');

$bookmarkMapper=new mmw_mapper_BookmarkMapper();

$url="http://www.google.com/";
$tag="prog";

/*********test findByUrl***********/
//$arBookmarks=$bookmarkMapper->findByUrl($url);
//
//print "testing findByUrl with \$url='$url' ...<br />";
//print "found ".count($arBookmarks)." results.<br />";
//print "var_dump of the array gives :<br />";
//var_dump($arBookmarks);

/*********test findByTagLike********/
//$arTags=$bookmarkMapper->findByTagLike($tag);
//
//print "testing findByTagLike with \$tag='$tag' ...<br />";
//print "found ".count($arTags)." results.<br />";
//print "var_dump of the array gives :<br />";
//var_dump($arTags);

/*********test insertIds, existsHasIds, existsHasWebpageId, existsHasTagId and deleteIds*******/
$webpage_id=4000;
$tags_id=4000;

print "inserting ids ($webpage_id,$tags_id)...<br />";
$bookmarkMapper->insertIds($webpage_id,$tags_id);

testExistsMiscIds($bookmarkMapper,$webpage_id,$tags_id);

print "deleting these same ids...<br />";
$bookmarkMapper->deleteIds($webpage_id, $tags_id);

testExistsMiscIds($bookmarkMapper,$webpage_id,$tags_id);

function testExistsMiscIds($bookmarkMapper,$webpage_id, $tags_id) {
    print "do these ids ($webpage_id,$tags_id) exist ?";
    $bookmarkMapper->existsHasIds($webpage_id,$tags_id)?print "true":print "false";
    print "<br />";
    
    print "does the webpage_id $webpage_id exists ?";
    $bookmarkMapper->existsHasWebpageId($webpage_id)?print "true":print "false";
    print "<br />";
   
    print "does the tags_id ($tags_id) exists ?";
    $bookmarkMapper->existsHasTagId($tags_id)?print "true":print "false";
    print "<br />";
}
?>
